package behavior.state;

import java.util.Random;

//可抽奖状态
public class CanRaffleState extends State {
    public CanRaffleState(Activity activity) {
        super(activity);
    }

    @Override
    boolean raffle() {
        System.out.println("正在抽奖");
        Random random = new Random();
        int num = random.nextInt(10);
        if(num==0){
            //抽中
            activity.setState(new DispenseState(activity));
            return true;
        }else  {
            //未中
            activity.setState(new NoRaffleState(activity));
            return false;
        }
    }
}
